//获取应用实例
var config = require("../../config.js");
Page({
  data: {
   departmentList:[],
   
   
  },
  onLoad: function () {
    var that = this;
    that.setData({
      zixun: config.zixun
    });
    /**
     * 获取部门列表
     */
    wx.request({
      url: config.baseUri + `/department/${config.userId}/list`,
      method: 'GET', // OPTIONS, GET, HEAD, POST, PUT, DELETE, TRACE, CONNECT
      // header: {}, // 设置请求的 header
      success:  (res) => {
        console.log(res);
        this.setData({
          departmentList: [...this.data.departmentList,...res.data.data]
        })
      }
    });

    //调用应用实例的方法获取全局数据
    // app.getUserInfo(function (userInfo) {
    //   //更新数据
    //   that.setData({
    //     userInfo: userInfo
    //   })
    // })
  }
});